import datetime
import json


class MyJsonEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, datetime.datetime):
            return obj.strftime("%Y-%m%d %H:%M:%s")
        if isinstance(obj, bytes):
            return str(obj, encoding='utf-8')
        if isinstance(obj, int):
            return int(obj)
        if isinstance(obj, float):
            return float(obj)
        else:
            return super(MyJsonEncoder, self).default(obj)
